<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./data.js"></script>
    <script>
      let news = {}
      function render(newObj, oldObj) {
        for (let key in oldObj) {
          if (oldObj[key] instanceof Array) {
            newObj[key] = []
            render(newObj[key], oldObj[key])
          } else if (oldObj[key] instanceof Object) {
            newObj[key] = {}
            render(newObj[key], oldObj[key])
          } else {
              if (key === 'label') {
                newObj['newlabel'] = oldObj[key]
              } else {
                newObj[key] = oldObj[key]
              }
          }
        }
      }
      render(news, res)
      console.log(res);
      console.log(news);
    </script>
  </body>
</html>
